package com.sky.mapper;


import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

       /**
        * 根据菜品id查询套餐信息
        * @param id
        * @return
        */
       @Select("select count(1) from setmeal_dish where dish_id in (#{id})")
       Integer countByDishId(Long id);

       /**
        * 批量插入套餐菜品关系数据
        * @param setmealDishes
        */
       void insertBatch(List<SetmealDish> setmealDishes);


       /**
        * 根据套餐id删除套餐菜品关系数据
        * @param setmealIds
        */
       void deleteBySetmealId(List<Long> setmealIds);
       /**
        * 根据套餐id查询套餐菜品关系数据
        * @param id
        * @return
        */
       @Select("select * from setmeal_dish where setmeal_id = #{id}")
       List<SetmealDish> getBySetmealId(Long id);

       /**
        * 根据套餐id查询套餐菜品关系数据
        * @param id
        * @return
        */
       @Select("select a.name,a.price,b.copies,a.image,a.description from setmeal_dish b left join dish a on b.dish_id = a.id where b.setmeal_id = #{id}")
       List<DishItemVO> getDishItemById(Long id);
}
